package com.finance.cooperate.data.service.impl;

import com.finance.cooperate.dao.entity.primary.User;
import com.finance.cooperate.dao.repository.primary.UserRepository;
import com.finance.cooperate.data.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * @ClassName UserServiceImpl
 * @Description TODO
 * @Author shen
 * @Date 2023/8/10 21:45
 * @Modify ...
 */
@Slf4j
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserRepository userRepository;

    @Override
    public String getDeviceId(String uid) {

        Optional<User> optional = userRepository.findById(uid);

        if (optional.isPresent()) {
            User user = optional.get();

            return user.getDeviceId();

        }

        return null;
    }
}
